import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [{
    path: '/',
    redirect: '/page'
  },
  {
    path: '/admin',
    name: 'Admin',
    redirect: '/admin/list',
    component: () => import( /* webpackChunkName: "Admin" */ '../layout/Admin.vue'),
    children: [{
        path: 'list',
        name: 'List',
        component: () => import( /* webpackChunkName: "List" */ '../views/List.vue'),
      },
      {
        path: 'detail/:id',
        name: 'Detail',
        component: () => import( /* webpackChunkName: "detail" */ '../views/Detail.vue'),
      }
    ]
  },
  {
    path: '/page',
    name: 'Page',
    component: () => import( /* webpackChunkName: "Page" */ '../layout/Page.vue'),
    redirect: '/page/login',
    children: [{
        path: 'login',
        name: 'Login',
        component: () => import( /* webpackChunkName: "login" */ '../views/Login.vue'),
      },
      {
        path: 'register',
        name: 'Register',
        component: () => import( /* webpackChunkName: "register" */ '../views/Register.vue'),
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router